import React, { useRef } from 'react'

export default function App() {
  const inputRef = useRef()

  return (
    <div>
      <input type="text" ref={inputRef} />
      <button
        onClick={() => {
          console.log(inputRef)
          console.log(inputRef.current.value)
        }}
      >
        点击按钮打印值
      </button>
    </div>
  )
}
